# src/config.py

import os
from dotenv import load_dotenv

# 加载 .env 文件中的环境变量
load_dotenv()

# --- API Keys ---
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")

# --- Model Configuration ---
# 用于生成问题和作为微调基础的模型
BASE_MODEL = "gpt-3.5-turbo"
# 用于生成高质量训练数据的“教师”模型（推荐使用 GPT-4）
# 注意：原始 notebook 使用了 gpt-3.5-turbo，但蒸馏的初衷是使用更强的模型
TEACHER_MODEL = "gpt-4-turbo"
# 微调后模型的温度参数
FINETUNED_MODEL_TEMP = 0.3
BASE_MODEL_TEMP = 0.3

# --- Data Paths and URLs ---
PDF_URL = "https://www.ipcc.ch/report/ar6/wg2/downloads/report/IPCC_AR6_WGII_Chapter03.pdf"
DATA_DIR = "data"
PDF_PATH = os.path.join(DATA_DIR, "IPCC_AR6_WGII_Chapter03.pdf")
TRAIN_QUESTIONS_PATH = os.path.join(DATA_DIR, "train_questions.txt")
EVAL_QUESTIONS_PATH = os.path.join(DATA_DIR, "eval_questions.txt")
FINETUNING_EVENTS_PATH = os.path.join(DATA_DIR, "finetuning_events.jsonl")

# --- Generation and Fine-tuning Parameters ---
# 使用文档的前50页生成训练问题
TRAIN_DOCS_LIMIT = 50
# 使用文档第50页之后的部分生成评估问题
EVAL_DOCS_START = 50
NUM_QUESTIONS_TO_GENERATE = 40
RANDOM_SEED = 42

# --- RAG and Evaluation Parameters ---
# RAG 检索时返回最相关的 top_k 个文档
SIMILARITY_TOP_K = 2
# 为测试 refine 过程，限制上下文窗口大小
CONTEXT_WINDOW = 2048

# --- Prompts ---
QUESTION_GEN_QUERY = (
    "You are a Teacher/ Professor. Your task is to setup "
    "a quiz/examination. Using the provided context, formulate "
    "a single question that captures an important fact from the "
    "context. Restrict the question to the context information provided."
)